#include "StdAfx.h"
#include "DeviceInfo.h"

//AppName
#define APPNAME_DEVICE_INFO			_T("DEVICE_INFO")
#define APPNAME_DEVICE_INFO_EX		_T("DEVICE_INFO_EX")
#define APPNAME_FRONT_CAMERA		_T("FRONT_CAMERA")
#define APPNAME_REAR_CAMERA			_T("REAR_CAMERA")

#define APPNAME_CAMERA_SEL			_T("CAM%02d")
#define APPNAME_RESOL				_T("CAM%02d_RESOL%d")
#define APPNAME_RESOL_OPT			_T("CAM%02d_RESOL%d_OPT0")
#define APPNAME_AUDIO				_T("AudioControl")



//KeyName
//1. DEVICE_INFO
#define KEYNAME_version				_T("version")
#define KEYNAME_modelName			_T("modelName")
#define KEYNAME_MaxChannel			_T("MaxChannel")
#define KEYNAME_AutoChannelDetect	_T("AutoChannelDetect")
#define KEYNAME_InternalName		_T("InternalName")
#define KEYNAME_ModeDiff			_T("ModeDiff")

//2. FRONT/REAR_CAMERA
#define KEYNAME_enable				_T("enable")
#define KEYNAME_supportResolution	_T("supportResolution%d")
#define KEYNAME_substreamResolution _T("substreamResolution")
#define KEYNAME_supportSubstream	_T("supportSubstream")
#define KEYNAME_maxFrameRate		_T("maxFrameRate")

#define KEYNAME_mainChip			_T("mainChip")
#define KEYNAME_position			_T("position")
#define KEYNAME_isp					_T("isp")
#define KEYNAME_fpscontrol			_T("fpsControl")
#define KEYNAME_fpsctrl_motion		_T("MotionFpsCtrl")
#define KEYNAME_MainWidth			_T("MainWidth")
#define KEYNAME_MainHeight			_T("MainHeight")
#define KEYNAME_MainFps				_T("MainFps")
#define KEYNAME_MotionFps			_T("MotionFps")
#define KEYNAME_SubEnable			_T("SubEnable")
#define KEYNAME_SubWidth			_T("SubWidth")
#define KEYNAME_SubHeight			_T("SubHeight")
#define KEYNAME_SubFps				_T("SubFps")
#define KEYNAME_MainFps_Sub			_T("MainFps_Sub")
#define KEYNAME_PbEnable			_T("PbEnable")
#define KEYNAME_PbWidth				_T("PbWidth")
#define KEYNAME_PbHeight			_T("PbHeight")
#define KEYNAME_PbFps				_T("PbFps")
#define KEYNAME_MainFps_Pb			_T("MainFps_Pb")
#define KEYNAME_input				_T("input")
#define KEYNAME_output				_T("output")

#define DEF_NVP2400					_T("NVP2400")



CDeviceInfo::CDeviceInfo(void)
{
	m_bLoad = FALSE;
}

CDeviceInfo::~CDeviceInfo(void)
{
}

void CDeviceInfo::LoadCfgFile(CString strFileName)
{
	CString strAppName;
	CString strISP = _T("OTHER");
	int i, r;

	int nDefaultWidth[MAX_STREAM_RESOLUTION] = { 1920, 1280, 720 };
	int nDefaultHeight[MAX_STREAM_RESOLUTION] = { 1080, 720, 576 };

	CStringArray sarrPosition;
	sarrPosition.Add(_T("FRONT"));
	sarrPosition.Add(_T("REAR"));
	sarrPosition.Add(_T("LEFT"));
	sarrPosition.Add(_T("RIGHT"));
	sarrPosition.Add(_T("TOP"));
	sarrPosition.Add(_T("BOTTOM"));
	sarrPosition.Add(_T("INSIDE"));

	m_strModelName.GetBuffer(32);
	GetPrivateProfileString(APPNAME_DEVICE_INFO, KEYNAME_modelName, _T(""), m_strModelName.GetBuffer(0), 32, strFileName);
	m_strChipset.GetBuffer(32);
	GetPrivateProfileString(APPNAME_DEVICE_INFO_EX, KEYNAME_mainChip, _T(""), m_strChipset.GetBuffer(0), 32, strFileName);
	m_strInternalName.GetBuffer(32);
	GetPrivateProfileString(APPNAME_DEVICE_INFO_EX, KEYNAME_InternalName, _T(""), m_strInternalName.GetBuffer(0), 32, strFileName);

	m_nMaxChannel = GetPrivateProfileInt(APPNAME_DEVICE_INFO_EX, KEYNAME_MaxChannel, 1, strFileName);
	m_bAutoChannelDetect = GetPrivateProfileInt(APPNAME_DEVICE_INFO_EX, KEYNAME_AutoChannelDetect, 0, strFileName);
	m_dwModeDiff = (DWORD)GetPrivateProfileInt(APPNAME_DEVICE_INFO_EX, KEYNAME_ModeDiff, 0x0000, strFileName);

	for (i=0;i<MAX_CHANNEL;i++)
	{
		strAppName.Format(APPNAME_CAMERA_SEL, i);
		m_stStreamProp[i].bCameraEnable = GetPrivateProfileInt(strAppName, KEYNAME_enable, i==0, strFileName);
		m_stStreamProp[i].strPosition.GetBuffer(32);
		GetPrivateProfileString(strAppName, KEYNAME_position, sarrPosition.GetAt(i), 
			m_stStreamProp[i].strPosition.GetBuffer(0), 32, strFileName);

		m_stStreamProp[i].strISP.GetBuffer(32);
		GetPrivateProfileString(strAppName, KEYNAME_isp, strISP, m_stStreamProp[i].strISP.GetBuffer(0), 32, strFileName);

		if (m_stStreamProp[i].strISP.Compare(DEF_NVP2400) == 0)
			m_stStreamProp[i].nSensor_NVP2400 = isp_NVP2400;
		else
			m_stStreamProp[i].nSensor_NVP2400 = isp_other;
		m_stStreamProp[i].bControlFps = GetPrivateProfileInt(strAppName, KEYNAME_fpscontrol, 1, strFileName);
		m_stStreamProp[i].bMotionFps = GetPrivateProfileInt(strAppName, KEYNAME_fpsctrl_motion, 0, strFileName);

		for (r=0;r<MAX_STREAM_RESOLUTION;r++)
		{
			strAppName.Format(APPNAME_RESOL, i, r);

			m_stStreamProp[i].stResolProp[r].bResolEnable = GetPrivateProfileInt(strAppName, KEYNAME_enable, r==0, strFileName);
			m_stStreamProp[i].stResolProp[r].nMainWidth = GetPrivateProfileInt(strAppName, KEYNAME_MainWidth, nDefaultWidth[r], strFileName);
			m_stStreamProp[i].stResolProp[r].nMainHeight = GetPrivateProfileInt(strAppName, KEYNAME_MainHeight, nDefaultHeight[r], strFileName);
			m_stStreamProp[i].stResolProp[r].nMainFps = GetPrivateProfileInt(strAppName, KEYNAME_MainFps, 30, strFileName);
			m_stStreamProp[i].stResolProp[r].nMotionFps = GetPrivateProfileInt(strAppName, KEYNAME_MotionFps, 30, strFileName);
			m_stStreamProp[i].stResolProp[r].bSubstreamSupport = GetPrivateProfileInt(strAppName, KEYNAME_SubEnable, FALSE, strFileName);
			m_stStreamProp[i].stResolProp[r].nSubWidth = GetPrivateProfileInt(strAppName, KEYNAME_SubWidth, 640, strFileName);
			m_stStreamProp[i].stResolProp[r].nSubHeight = GetPrivateProfileInt(strAppName, KEYNAME_SubHeight, 360, strFileName);
			m_stStreamProp[i].stResolProp[r].nSubFps = GetPrivateProfileInt(strAppName, KEYNAME_SubFps, 30, strFileName);
			m_stStreamProp[i].stResolProp[r].nMainFps_Sub = GetPrivateProfileInt(strAppName, KEYNAME_MainFps_Sub, 30, strFileName);
			m_stStreamProp[i].stResolProp[r].bPbSupport = GetPrivateProfileInt(strAppName, KEYNAME_PbEnable, FALSE, strFileName);
			m_stStreamProp[i].stResolProp[r].nPbWidth = GetPrivateProfileInt(strAppName, KEYNAME_PbWidth, 640, strFileName);
			m_stStreamProp[i].stResolProp[r].nPbHeight = GetPrivateProfileInt(strAppName, KEYNAME_PbHeight, 360, strFileName);
			m_stStreamProp[i].stResolProp[r].nPbFps = GetPrivateProfileInt(strAppName, KEYNAME_PbFps, 30, strFileName);
			m_stStreamProp[i].stResolProp[r].nMainFps_Pb = GetPrivateProfileInt(strAppName, KEYNAME_MainFps_Pb, 30, strFileName);

			strAppName.Format(APPNAME_RESOL_OPT, i, r);

			m_stStreamProp[i].stResolPropOpt[r].bResolEnable = GetPrivateProfileInt(strAppName, KEYNAME_enable, r==0, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMainWidth = GetPrivateProfileInt(strAppName, KEYNAME_MainWidth, nDefaultWidth[r], strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMainHeight = GetPrivateProfileInt(strAppName, KEYNAME_MainHeight, nDefaultHeight[r], strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMainFps = GetPrivateProfileInt(strAppName, KEYNAME_MainFps, 30, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMotionFps = GetPrivateProfileInt(strAppName, KEYNAME_MotionFps, 30, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].bSubstreamSupport = GetPrivateProfileInt(strAppName, KEYNAME_SubEnable, FALSE, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nSubWidth = GetPrivateProfileInt(strAppName, KEYNAME_SubWidth, 640, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nSubHeight = GetPrivateProfileInt(strAppName, KEYNAME_SubHeight, 360, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nSubFps = GetPrivateProfileInt(strAppName, KEYNAME_SubFps, 30, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMainFps_Sub = GetPrivateProfileInt(strAppName, KEYNAME_MainFps_Sub, 30, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].bPbSupport = GetPrivateProfileInt(strAppName, KEYNAME_PbEnable, FALSE, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nPbWidth = GetPrivateProfileInt(strAppName, KEYNAME_PbWidth, 640, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nPbHeight = GetPrivateProfileInt(strAppName, KEYNAME_PbHeight, 360, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nPbFps = GetPrivateProfileInt(strAppName, KEYNAME_PbFps, 30, strFileName);
			m_stStreamProp[i].stResolPropOpt[r].nMainFps_Pb = GetPrivateProfileInt(strAppName, KEYNAME_MainFps_Pb, 30, strFileName);
		}
	}

	m_bAudioInputGain = GetPrivateProfileInt(APPNAME_AUDIO, KEYNAME_input, TRUE, strFileName);
	m_bAudioOutputGain = GetPrivateProfileInt(APPNAME_AUDIO, KEYNAME_output, TRUE, strFileName);

	//check value
#if 0
	TRACE(_T("[%s]\n"), APPNAME_DEVICE_INFO);
	TRACE(_T("%s = %s\n\n"), KEYNAME_modelName, m_strModelName);
	TRACE(_T("[%s]\n"), APPNAME_DEVICE_INFO_EX);
	TRACE(_T("%s = %s\n"), KEYNAME_mainChip, m_strChipset);
	TRACE(_T("%s = %d\n\n"), KEYNAME_MaxChannel, m_nMaxChannel);

	for (i=0;i<MAX_CHANNEL;i++)
	{
		strAppName.Format(APPNAME_CAMERA_SEL, i);
		TRACE(_T("[%s]\n"), strAppName);
		TRACE(_T("%s = %d\n"), KEYNAME_enable, m_stStreamProp[i].bCameraEnable);
		TRACE(_T("%s = %s\n"), KEYNAME_position, m_stStreamProp[i].strPosition);
		TRACE(_T("%s = %d\n"), KEYNAME_isp, m_stStreamProp[i].nSensor_NVP2400);
		TRACE(_T("%s = %d\n\n"), KEYNAME_fpscontrol, m_stStreamProp[i].bControlFps);

		for (r=0;r<MAX_STREAM_RESOLUTION;r++)
		{
			strAppName.Format(APPNAME_RESOL, i, r);
			TRACE(_T("[%s]\n"), strAppName);
			TRACE(_T("%s = %d\n"), KEYNAME_enable, m_stStreamProp[i].stResolProp[r].bResolEnable);
			TRACE(_T("%s = %d\n"), KEYNAME_MainWidth, m_stStreamProp[i].stResolProp[r].nMainWidth);
			TRACE(_T("%s = %d\n"), KEYNAME_MainHeight, m_stStreamProp[i].stResolProp[r].nMainHeight);
			TRACE(_T("%s = %d\n\n"), KEYNAME_MainFps, m_stStreamProp[i].stResolProp[r].nMainFps);

			TRACE(_T("%s = %d\n"), KEYNAME_SubEnable, m_stStreamProp[i].stResolProp[r].bSubstreamSupport);
			TRACE(_T("%s = %d\n"), KEYNAME_SubWidth, m_stStreamProp[i].stResolProp[r].nSubWidth);
			TRACE(_T("%s = %d\n"), KEYNAME_SubHeight, m_stStreamProp[i].stResolProp[r].nSubHeight);
			TRACE(_T("%s = %d\n"), KEYNAME_SubFps, m_stStreamProp[i].stResolProp[r].nSubFps);
			TRACE(_T("%s = %d\n\n"), KEYNAME_MainFps_Sub, m_stStreamProp[i].stResolProp[r].nMainFps_Sub);

			TRACE(_T("%s = %d\n"), KEYNAME_PbEnable, m_stStreamProp[i].stResolProp[r].bPbSupport);
			TRACE(_T("%s = %d\n"), KEYNAME_PbWidth, m_stStreamProp[i].stResolProp[r].nPbWidth);
			TRACE(_T("%s = %d\n"), KEYNAME_PbHeight, m_stStreamProp[i].stResolProp[r].nPbHeight);
			TRACE(_T("%s = %d\n"), KEYNAME_PbFps, m_stStreamProp[i].stResolProp[r].nPbFps);
			TRACE(_T("%s = %d\n\n"), KEYNAME_MainFps_Pb, m_stStreamProp[i].stResolProp[r].nMainFps_Pb);
		}
	}

	TRACE(_T("[%s]"), APPNAME_AUDIO);
	TRACE(_T("%s = %d\n"), KEYNAME_input, m_bAudioInputGain);
	TRACE(_T("%s = %d\n"), KEYNAME_output, m_bAudioOutputGain);
	TRACE(_T("\n\n"));


#endif
	sarrPosition.RemoveAll();	

	m_bLoad = TRUE;

}

void CDeviceInfo::LoadCfgFileUnknown()
{
	CString strAppName;
	CString strISP = _T("OTHER");
	int i, r;

	int nDefaultWidth[MAX_STREAM_RESOLUTION] = { 1920, 1280, 720 };
	int nDefaultHeight[MAX_STREAM_RESOLUTION] = { 1080, 720, 576 };

	CStringArray sarrPosition;
	sarrPosition.Add(_T("FRONT"));
	sarrPosition.Add(_T("REAR"));
	sarrPosition.Add(_T("LEFT"));
	sarrPosition.Add(_T("RIGHT"));
	sarrPosition.Add(_T("TOP"));
	sarrPosition.Add(_T("BOTTOM"));
	sarrPosition.Add(_T("INSIDE"));

	m_strModelName.Format(_T("UNKNOWN"));
	m_strChipset.Format(_T("UNKNOWN"));
	m_strInternalName.Format(_T("UNKNOWN"));

	m_bAutoChannelDetect = 0;
	m_dwModeDiff = 0x0000;

	m_nMaxChannel = 2;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		m_stStreamProp[i].bCameraEnable = TRUE;
		m_stStreamProp[i].strPosition = sarrPosition.GetAt(i);
		m_stStreamProp[i].strISP = (i==0) ? _T("NVP2400") : _T("OTHER");
		m_stStreamProp[i].nSensor_NVP2400 = (i==0) ? isp_NVP2400 : isp_other;
		m_stStreamProp[i].bControlFps = TRUE;

		for (r=0;r<MAX_STREAM_RESOLUTION;r++)
		{
			strAppName.Format(APPNAME_RESOL, i, r);

			m_stStreamProp[i].stResolProp[r].bResolEnable = (r<2);
			m_stStreamProp[i].stResolProp[r].nMainWidth = (r==0) ? 1920 : 1280;
			m_stStreamProp[i].stResolProp[r].nMainHeight = (r==0) ? 1080 : 720;
			m_stStreamProp[i].stResolProp[r].nMainFps = 30;
			m_stStreamProp[i].stResolProp[r].bSubstreamSupport = TRUE;
			m_stStreamProp[i].stResolProp[r].nSubWidth = 640;
			m_stStreamProp[i].stResolProp[r].nSubHeight = 360;
			m_stStreamProp[i].stResolProp[r].nSubFps = 30;
			m_stStreamProp[i].stResolProp[r].nMainFps_Sub = 30;
			m_stStreamProp[i].stResolProp[r].bPbSupport = TRUE;
			m_stStreamProp[i].stResolProp[r].nPbWidth = 640;
			m_stStreamProp[i].stResolProp[r].nPbHeight = 360;
			m_stStreamProp[i].stResolProp[r].nPbFps = 30;
			m_stStreamProp[i].stResolProp[r].nMainFps_Pb = 30;
		}
	}

	m_bAudioInputGain = TRUE;
	m_bAudioOutputGain = TRUE;

	m_bLoad = FALSE;

	sarrPosition.RemoveAll();
}

BOOL CDeviceInfo::GetDefault(KConfig *pKConfig)
{
	ZeroMemory(pKConfig, sizeof(KConfig));
	GetDefault_Common(pKConfig);
	if (m_strInternalName.Compare(_T("NVS2310_FHD1"))==0)
		GetDefault_NVS2310_FHD1(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3310_FH1HD1"))==0)
		GetDefault_NVS3310_FH1HD1(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3310_FH2HD2"))==0)
		GetDefault_NVS3310_FH2HD2(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3310_HD1HD1"))==0)
		GetDefault_NVS3310_HD1HD1(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3600-HD"))==0)
		GetDefault_NVS3600_HD(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3660_FH1"))==0)
		GetDefault_NVS3660_FH1(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3660_HD2D1"))==0)
		GetDefault_NVS3660_HD2D1(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3660_HD2HD2"))==0)
		GetDefault_NVS3660_HD2HD2(pKConfig);
	else if (m_strInternalName.Compare(_T("NVS3310_FH1_HD1HD1")) == 0)
		GetDefault_NVS3310_FH1_HD1HD1(pKConfig);
	else
		return FALSE;
	return TRUE;
}

//NVS3660
void CDeviceInfo::GetDefault_NVS3660_FH1(KConfig *pKConfig)
{
 	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
 	PKCamera pKCamera;
//	PKSystem pKSystem;

 	for (i=0;i<MAX_CHANNEL;i++)
 	{
 		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
// 		pKCamera->Motion.nPostEventRecTime = 20;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
// 		pKCamera->Record.nFPS = 30;
// 		pKCamera->Record.nQuality = 2;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
 		pKCamera->Record.nResol = RES_FHD;
// 
 		pKCamera->ParkingMode.nResol = RES_FHD;
// 		pKCamera->ParkingMode.nFPS = 30;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
 	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = 0;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
// 	pKConfig->Sensor.nPostEventRecTime = 20;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
//	pKSystem->nLanguage = LANG_ENGLISH;
//	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
// 	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_NVS3660_HD2D1(KConfig *pKConfig)
{
 	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
// 		pKCamera->Motion.nPostEventRecTime = 20;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
// 		pKCamera->Record.nFPS = 30;
// 		pKCamera->Record.nQuality = 2;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = (i==0) ? RES_HD : RES_D1;
// 
 		pKCamera->ParkingMode.nResol = (i==0) ? RES_HD : RES_D1;
// 		pKCamera->ParkingMode.nFPS = 30;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = 0;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
// 	pKConfig->Sensor.nPostEventRecTime = 20;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
//	pKSystem->nLanguage = LANG_ENGLISH;
//	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
// 	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_NVS3660_HD2HD2(KConfig *pKConfig)
{
	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
// 		pKCamera->Motion.nPostEventRecTime = 20;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
// 		pKCamera->Record.nFPS = 30;
// 		pKCamera->Record.nQuality = 2;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = RES_HD;
// 
 		pKCamera->ParkingMode.nResol = RES_HD;
// 		pKCamera->ParkingMode.nFPS = 30;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = 0;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
// 	pKConfig->Sensor.nPostEventRecTime = 20;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
//	pKSystem->nLanguage = LANG_ENGLISH;
//	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
// 	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

//NVS3600
void CDeviceInfo::GetDefault_NVS3600_HD(KConfig *pKConfig)
{
	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);

// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;

		pKCamera->Motion.bEnable = TRUE;
		pKCamera->Motion.Sensitivity.nSensitivity = 2;
		pKCamera->Motion.Sensitivity.nSpatial = 2;
		pKCamera->Motion.Sensitivity.nBlackLevel = 0;
		pKCamera->Motion.Sensitivity.nWhiteLevel = 0;

//		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));

// 		pKCamera->Motion.nPostEventRecTime = 20;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;

		pKCamera->Record.nFPS = 15;
		pKCamera->Record.nQuality = 2;
		pKCamera->Record.bAudio = FALSE;
		pKCamera->Record.nSchedule = 0;
		pKCamera->Record.nResol = RES_HD;

		pKCamera->ParkingMode.nResol = RES_HD;
		pKCamera->ParkingMode.nFPS = 15;				//??
		pKCamera->ParkingMode.nQuality = 2;
	}

// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], (RECORD_MODE_EVENT>>4), sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = FALSE;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
// 	pKConfig->Sensor.nPostEventRecTime = 20;
// 	pKConfig->Sensor.nBuzzerTime = 0;

	pKSystem = &pKConfig->System;

// 	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
// 	pKSystem->bPAL = 0;
// 	pKSystem->nLanguage = LANG_ENGLISH;
	pKSystem->nLogSet = 0;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
// 	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

//NVS2310
void CDeviceInfo::GetDefault_NVS2310_FHD1(KConfig *pKConfig)
{
// 	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
// 	PKCamera pKCamera;
 	PKSystem pKSystem;

// 	for (i=0;i<MAX_CHANNEL;i++)
// 	{
// 		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 			
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
// 		pKCamera->Motion.nPostEventRecTime = 20;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
// 		pKCamera->Record.nFPS = 30;
// 		pKCamera->Record.nQuality = 2;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
// 		pKCamera->Record.nResol = RES_FHD;
// 
// 		pKCamera->ParkingMode.nResol = RES_FHD;
// 		pKCamera->ParkingMode.nFPS = 30;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
// 	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = 0;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
// 	pKConfig->Sensor.nPostEventRecTime = 20;
// 	pKConfig->Sensor.nBuzzerTime = 0;
// 
 	pKSystem = &pKConfig->System;
// 
// 	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
// 	pKSystem->bPAL = 0;
 	pKSystem->nLanguage = LANG_KOREAN;
 	pKSystem->nLogSet = 0;
// 
// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
// 	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;

	
}

//NVS3310
void CDeviceInfo::GetDefault_NVS3310_FH1HD1(KConfig *pKConfig)
{
 	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
 		pKCamera->Motion.nPostEventRecTime = 30;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
		pKCamera->Record.nFPS = (i==0) ? 25 : 15;
 		pKCamera->Record.nQuality = 1;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = (i==0) ? RES_FHD : RES_HD;
// 
 		pKCamera->ParkingMode.nResol = (i==0) ? RES_FHD : RES_HD;
 		pKCamera->ParkingMode.nFPS = 15;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = FALSE;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
 	pKConfig->Sensor.nPostEventRecTime = 30;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
// 	pKSystem->nLanguage = LANG_ENGLISH;
// 	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
	pKConfig->oSpeakerAudio = 1;
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
 	pKConfig->nAudioInputVol = 6;
 	pKConfig->nAudioOutputVol = 6;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_NVS3310_FH2HD2(KConfig *pKConfig)
{
	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
 		pKCamera->Motion.nPostEventRecTime = 30;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
		pKCamera->Record.nFPS = 24;
 		pKCamera->Record.nQuality = 1;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = (i==0) ? RES_FHD : RES_HD;
// 
 		pKCamera->ParkingMode.nResol = (i==0) ? RES_FHD : RES_HD;
 		pKCamera->ParkingMode.nFPS = 24;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = FALSE;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
 	pKConfig->Sensor.nPostEventRecTime = 30;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
// 	pKSystem->nLanguage = LANG_ENGLISH;
// 	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
	pKConfig->oSpeakerAudio = 1;
// 	pKConfig->nStatus = 0;
// 	pKConfig->nDiskFlag = -1;
 	pKConfig->nAudioInputVol = 6;
 	pKConfig->nAudioOutputVol = 6;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_NVS3310_HD1HD1(KConfig *pKConfig)
{
	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
 		pKCamera->Motion.nPostEventRecTime = 30;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
//		pKCamera->Record.nFPS = 30;
 		pKCamera->Record.nQuality = 1;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = RES_HD;
// 
 		pKCamera->ParkingMode.nResol = RES_HD;
 		pKCamera->ParkingMode.nFPS = 15;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = FALSE;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
 	pKConfig->Sensor.nPostEventRecTime = 30;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
// 	pKSystem->nLanguage = LANG_ENGLISH;
// 	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
	pKConfig->oSpeakerAudio = 1;
// 	pKConfig->nDiskFlag = -1;
 	pKConfig->nAudioInputVol = 6;
 	pKConfig->nAudioOutputVol = 6;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_NVS3310_FH1_HD1HD1(KConfig *pKConfig)
{
	int i;
// 	CHAR szTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
//	PKSystem pKSystem;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
// 		pKCamera->nChannel = i;
// 		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));
// 
// 		ZeroMemory(szTitle, sizeof(szTitle));
// 		WideCharToMultiByte(CP_ACP, 0, 
// 			(LPCWSTR)m_stStreamProp[i].strPosition.GetBuffer(0), 
// 			m_stStreamProp[i].strPosition.GetLength(), szTitle, MAX_TITLE_LEN, 
// 			NULL, NULL);
// 
// 		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);
// 
// 		pKCamera->Color.nBright = 50;
// 		pKCamera->Color.nContrast = 50;
// 		pKCamera->Color.nHue = 50;
// 		pKCamera->Color.nSaturation = 50;
// 		pKCamera->Color.bSharpness = FALSE;
// 
// 		pKCamera->Motion.bEnable = TRUE;
// 		pKCamera->Motion.Sensitivity.nSensitivity = 3;
// 		pKCamera->Motion.Sensitivity.nSpatial = 3;
// 		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
// 		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;
// 
// 		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));
// 
 		pKCamera->Motion.nPostEventRecTime = 30;
// 		pKCamera->Motion.nBuzzerTime = 0;
// 		pKCamera->Motion.bMotionTrace = FALSE;
// 
//		pKCamera->Record.nFPS = 30;
 		pKCamera->Record.nQuality = 1;
// 		pKCamera->Record.bAudio = TRUE;
// 		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = RES_HD;
		// 
		pKCamera->ParkingMode.nResol = RES_HD;
 		pKCamera->ParkingMode.nFPS = 15;				//??
// 		pKCamera->ParkingMode.nQuality = 2;
	}
// 
// 	for (i=0;i<MAX_SCHEDULE;i++)
// 		memset(&pKConfig->RecMan.Schedule[i], RECORD_MODE_EVENT, sizeof(KSchedule));
// 
// 	pKConfig->RecMan.SystemMode = TRUE;
// 	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
// 	pKConfig->RecMan.AutoParkingMode = FALSE;
// 	pKConfig->RecMan.bOverWrite = TRUE;
// 	pKConfig->RecMan.bSubStream = FALSE;
// 	pKConfig->RecMan.bAuto = TRUE;
// 	pKConfig->RecMan.bPreEventRec = TRUE;
// 	pKConfig->RecMan.bAvi = TRUE;
// 
// 	//Sensor
// 	pKConfig->Sensor.bGSensorEvent = TRUE;
// 	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
 	pKConfig->Sensor.nPostEventRecTime = 30;
// 	pKConfig->Sensor.nBuzzerTime = 0;

//	pKSystem = &pKConfig->System;

//	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
//	pKSystem->bPAL = 0;
// 	pKSystem->nLanguage = LANG_ENGLISH;
// 	pKSystem->nLogSet = LOGSET_ALL;

// 	pKSystem->bDirIndicator = FALSE;
// 	pKSystem->bReverseGear = FALSE;
// 	pKSystem->nSpeedometer = 0;
// 	pKSystem->nOverspeed = 100;
// 
// 	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
// 	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
// 	pKSystem->timeinfo.nDst = 0;				//??
// 	pKSystem->nVGA = 1;			//CVBS video output
// 
// 	for (i=0;i<MAX_CHANNEL;i++)
// 		pKConfig->DispChan.QUADMode.nChnum[i] = i;
// 
// 	pKConfig->nStatus = 0;
	pKConfig->oSpeakerAudio = 1;
// 	pKConfig->nDiskFlag = -1;
 	pKConfig->nAudioInputVol = 6;
 	pKConfig->nAudioOutputVol = 6;
// 	pKConfig->fIspStatus = 0;
// 
// 	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
// 	pKConfig->nAbnormal = 0;
}

void CDeviceInfo::GetDefault_Common(KConfig *pKConfig)
{
	int i;
	CHAR szTitle[MAX_TITLE_LEN+1];
	CHAR szModelName[32];
	TCHAR tzModelName[32];
	TCHAR tzTitle[MAX_TITLE_LEN+1];
	PKCamera pKCamera;
	PKSystem pKSystem;

	wsprintf(tzModelName, _T("%s"), m_strModelName);
	ZeroMemory(szModelName, sizeof(szModelName));
	WideCharToMultiByte(CP_ACP, 0, 
		(LPCWSTR)tzModelName, 32,
		szModelName, 32, 
		NULL, NULL);
	strcpy_s((CHAR *)pKConfig->DeviceInfo.MODEL_NAME, 32, szModelName);

	pKConfig->DeviceInfo.VERSION_MAJOR = 0;
	pKConfig->DeviceInfo.VERSION_MINOR1 = 0;
	pKConfig->DeviceInfo.VERSION_MINOR2 = 0;

	for (i=0;i<MAX_CHANNEL;i++)
	{
		pKCamera = &pKConfig->Camera[i];
		pKCamera->nChannel = i;
		memset(pKCamera->Title, 0, sizeof(pKCamera->Title));

		wsprintf(tzTitle, _T("%s"), m_stStreamProp[i].strPosition);
		ZeroMemory(szTitle, sizeof(szTitle));
		WideCharToMultiByte(CP_ACP, 0, 
			(LPCWSTR)tzTitle, MAX_TITLE_LEN+1,
			szTitle, MAX_TITLE_LEN+1, 
			NULL, NULL);

		strcpy_s((CHAR *)pKCamera->Title, MAX_TITLE_LEN, szTitle);

		pKCamera->Color.nBright = 50;
		pKCamera->Color.nContrast = 50;
		pKCamera->Color.nHue = 50;
		pKCamera->Color.nSaturation = 50;
		pKCamera->Color.bSharpness = FALSE;

		pKCamera->Motion.bEnable = TRUE;
		pKCamera->Motion.Sensitivity.nSensitivity = 3;
		pKCamera->Motion.Sensitivity.nSpatial = 3;
		pKCamera->Motion.Sensitivity.nBlackLevel = 3;
		pKCamera->Motion.Sensitivity.nWhiteLevel = 3;

		ZeroMemory(pKCamera->Motion.Area, sizeof(pKCamera->Motion.Area));

		pKCamera->Motion.nPostEventRecTime = 20;
		pKCamera->Motion.nBuzzerTime = 0;
		pKCamera->Motion.bMotionTrace = FALSE;

		pKCamera->Record.nFPS = 30;
		pKCamera->Record.nQuality = 2;
		pKCamera->Record.bAudio = TRUE;
		pKCamera->Record.nSchedule = 1;
		pKCamera->Record.nResol = RES_FHD;

		pKCamera->ParkingMode.nResol = RES_FHD;
		pKCamera->ParkingMode.nFPS = 30;				//??
		pKCamera->ParkingMode.nQuality = 2;
	}

	for (i=0;i<MAX_SCHEDULE;i++)
		memset(&pKConfig->RecMan.Schedule[i], (RECORD_MODE_EVENT>>4), sizeof(KSchedule));

	pKConfig->RecMan.SystemMode = TRUE;
	pKConfig->RecMan.RecordMode = (RECORD_MODE_NORMAL | RECORD_MODE_EVENT);
	pKConfig->RecMan.AutoParkingMode = FALSE;
	pKConfig->RecMan.bOverWrite = TRUE;
	pKConfig->RecMan.bSubStream = 0;
	pKConfig->RecMan.bAuto = TRUE;
	pKConfig->RecMan.bPreEventRec = TRUE;
	pKConfig->RecMan.bAvi = TRUE;

	//Sensor
	pKConfig->Sensor.bGSensorEvent = TRUE;
	pKConfig->Sensor.nSenseGsensor = 3;					//define ranges
	pKConfig->Sensor.nPostEventRecTime = 20;
	pKConfig->Sensor.nBuzzerTime = 0;

	pKSystem = &pKConfig->System;

	ZeroMemory(pKSystem->Password, sizeof(pKSystem->Password));
	pKSystem->bPAL = 0;
	//pKSystem->nLanguage = LANG_ENGLISH;
	pKSystem->nLanguage = 1;
	pKSystem->nLogSet = LOGSET_ALL;

	pKSystem->bDirIndicator = FALSE;
	pKSystem->bReverseGear = FALSE;
	pKSystem->nSpeedometer = 0;
	pKSystem->nOverspeed = 100;

	pKSystem->timeinfo.nTimeFormat = ASIA;			//??
	pKSystem->timeinfo.nTimezone = TZ_UTC_P_09_00;
	pKSystem->timeinfo.nDst = 0;				//??
	pKSystem->nVGA = 1;			//CVBS video output

	for (i=0;i<MAX_CHANNEL;i++)
		pKConfig->DispChan.QUADMode.nChnum[i] = i;

	pKConfig->nStatus = 0;
	pKConfig->nDiskFlag = -1;
	pKConfig->nAudioInputVol = INPUT_AUDIO_VOLUMN_DEFAULT;
	pKConfig->nAudioOutputVol = OUTPUT_AUDIO_VOLUMN_DEFAULT;
	pKConfig->fIspStatus = ISP_STATUS_ALL;

	pKConfig->nScreenStatus = SCREEN_STATUS_ALL;
	pKConfig->nAbnormal = 0;

}